package model

interface IView {
    var x:Int
    var y:Int
    var width:Int
    var height:Int
    public fun draw()

    /**
     * 检测2个物体是否发生碰撞
     */
    public fun checkCollision(x1: Int, y1: Int, w1: Int, h1: Int, x2: Int, y2: Int, w2: Int, h2: Int):Boolean{
        return when{
            (x1+w1)<=x2 ->false
            x1>=(x2+w2) -> false
            (y1+h1)<=y2 ->false
            y1>=(y2+w2) -> false
            else ->true
        }
    }
}